Build custom SDK
To create binary services for your target platform, you need a suitable Software Development Kit (SDK). If a pre-built SDK isn't available or suitable, you'll need to build one.
The build and usage process differs depending on your target, such as AosVM (Yocto) or Raspberry Pi 5 (Moulin).
for AosVM (Yocto)
Prerequisite
This process assumes you have already successfully built the AosVM image. (To build the AosVM image, see meta-aos-vm).
The SDK relies on the results of a complete image build. The Yocto build system uses the compiled packages, libraries, and header files from the target image as the source material for creating the cross-compilation environment in the SDK. Therefore, the image must be built first.
Build SDK
Navigate to your yocto folder and set up the build environment:
source poky/oe-init-build-env build-main
Use the bitbake command to build the SDK for the aos-image-vm image:
bitbake aos-image-vm -c populate_sdk
The general Yocto command to build an SDK for any image is bitbake <your-image-name> -c populate_sdk.
Install SDK
After a successful build, the SDK installer script will be located in the deploy directory.
Install the SDK by executing this script. You may need to make it executable first (chmod +x ...).
./tmp/deploy/sdk/aos-vm-dev-glibc-x86_64-aos-image-vm-core2-64-genericx86-64-toolchain-5.0.7.sh
Follow the on-screen prompts and instructions to complete the installation.
Use SDK
Once the SDK is installed, you must source its environment setup script in your terminal session before you can build your source code.
Replace /sdk-install-dir/ with the path you chose during installation:
source /sdk-install-dir/environment-setup-core2-64-aosvm-linux
Now you are ready to build your binary services.
Customization
If you need to add additional packages to your SDK, you can set
TOOLCHAIN_HOST_TASK(for host packages) orTOOLCHAIN_TARGET_TASK(for device packages)
in your Yocto configuration before running the bitbake build command.
See the Yocto manual for more details.
for Raspberry Pi 5 (Moulin)
The SDK target is already integrated into the build configuration using the Moulin build system.
To build the SDK, run the following commands:
git clone https://github.com/aosedge/meta-aos-rpi.git && cd meta-aos-rpi
moulin aos-rpi.yaml
ninja aos-sdk